﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using MusicPlayer.Properties;


namespace MusicPlayer
{
    public partial class PlayList : Form
    {
        Point offset;   
        ImageList CloseImages=PlayForm.DivideImage(Resources.close,17,15,4);

        Music currentSong;
        ArrayList currentList;
        MusicPlayer.PlayForm mainForm;

        public PlayList()
        {
            InitializeComponent();
            mainForm = (MusicPlayer.PlayForm )this.Owner;

            pictureBoxClose.Image = CloseImages.Images[0];
            listBox2.Items.Add(new Music("千里之外",@"E:\Music\周杰伦\千里之外.wma"));
            listBox2.Items.Add(new Music("发如雪", @"E:\Music\周杰伦\发如雪.mp3"));
        }

       
        private void pictureBoxClose_MouseClick(object sender, MouseEventArgs e)
        {
            pictureBoxClose.Image = CloseImages.Images[2];
            this.Visible = false;
        }

        private void pictureBoxClose_MouseEnter(object sender, EventArgs e)
        {
            pictureBoxClose.Image = CloseImages.Images[1];
        }

        private void pictureBoxClose_MouseLeave(object sender, EventArgs e)
        {
            pictureBoxClose.Image = CloseImages.Images[0];
        }

        private void pictureBoxForm_MouseDown(object sender, MouseEventArgs e)
        {
            if (MouseButtons.Left != e.Button) return;

            Point cur = this.PointToScreen(e.Location);
            offset = new Point(cur.X - this.Left, cur.Y - this.Top);
        }

        private void pictureBoxForm_MouseMove(object sender, MouseEventArgs e)
        {
            if (MouseButtons.Left != e.Button) return;

            Point cur = MousePosition;
            this.Location = new Point(cur.X - offset.X, cur.Y - offset.Y);
        }

        private void listBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            currentSong = (Music )listBox2.SelectedItem;
        }
    }
}
